package com.luobd.base;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

@Data
public class PageInput {

    @ApiModelProperty(value = "页码，从1开始",example = "1")
    @NotNull(message = "请指定页码")
    @Min(value = 1,message = "页码必须大于等于1")
    private Integer pageNum = 1;

    @ApiModelProperty(value = "每页条数",example = "20")
    @NotNull(message = "请指定每页条数")
    private Integer pageSize = 20;

    @ApiIgnore(value = "仅后端内部使用")
    @ApiModelProperty(hidden = true)
    public Integer getStart() {
        return (pageNum - 1) * pageSize;
    }

}
